package pierwszy;

import org.openqa.selenium.NoSuchWindowException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class Note extends KsPDKPage{
	private WebDriver driver;
	private WebDriverWait wait;
	
	Note(WebDriver driver, WebDriverWait wait){
		super(driver, wait);
		this.driver = driver;
		this.wait = wait;
		
		if(!getIconPlusText().getText().equals(KsPDKPage.iconPlusOptionsMap.get("Notkę"))){
			throw new NoSuchWindowException("This is not the Note page");
		}
	}
	
	//Option list
	public NotesListPage chooseListNotesOption(){
		selectOptionList();
		
		wait.until(ExpectedConditions.presenceOfElementLocated(NoteUiMapping.listNotesOptionList));
		WebElement listNotesOption = driver.findElement(NoteUiMapping.listNotesOptionList);
		listNotesOption.click();
		
		return new NotesListPage(driver,wait);
	}
	
	public NotePage chooseAddNoteOption(){
		selectOptionList();
		
		wait.until(ExpectedConditions.presenceOfElementLocated(NoteUiMapping.addNoteOptionList));
		WebElement addNoteOption = driver.findElement(NoteUiMapping.addNoteOptionList);
		addNoteOption.click();
		
		return new NotePage(driver,wait);
	}
}
